package cn.stylefeng.guns.modular.storage.mapper;

import cn.stylefeng.guns.modular.storage.entity.StorageOutDetailed;
import cn.stylefeng.guns.modular.storage.model.params.StorageOutDetailedParam;
import cn.stylefeng.guns.modular.storage.model.params.StorageOutParam;
import cn.stylefeng.guns.modular.storage.model.result.StorageOutDetailedResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 拣货单明细表 Mapper 接口
 */
public interface StorageOutDetailedMapper extends BaseMapper<StorageOutDetailed> {

    /**
     * 获取列表
     *
     * @author hu
     * @Date 2019-07-15
     */
    List<StorageOutDetailedResult> customList(@Param("paramCondition") StorageOutDetailedParam paramCondition);

    /**
     * 获取map列表
     *
     * @author hu
     * @Date 2019-07-15
     */
    List<Map<String, Object>> customMapList(@Param("paramCondition") StorageOutDetailedParam paramCondition);

    /**
     * 获取分页实体列表
     *
     * @author hu
     * @Date 2019-07-15
     */
    Page<StorageOutDetailedResult> customPageList(@Param("page") Page page, @Param("paramCondition") StorageOutDetailedParam paramCondition, @Param("condition") String condition);
    
    /**
     * 获取分页map列表
     *
     * @author hu
     * @Date 2019-07-15
     */
    Page<Map<String, Object>> customPageMapList(@Param("page") Page page, @Param("paramCondition") StorageOutDetailedParam paramCondition);

    /**
     * 去重商品
     * @param pageContext
     * @param storageOutDetailedParam
     * @return
     */
    Page<StorageOutDetailedResult> findDistinctGoods(@Param("page")Page pageContext, @Param("paramCondition") StorageOutDetailedParam storageOutDetailedParam);

    List<StorageOutDetailedResult> findListBySpec(@Param("paramCondition")StorageOutDetailedParam param);

    /**
     * 批量保存
     * @param list
     * @return
     */
    boolean saveBatchList(@Param("list")List<StorageOutDetailed> list);

    /**
     * 批量更新
     * @param detailedList
     * @return
     */
    boolean updateBatchList(@Param("detailedList")List<StorageOutDetailed> detailedList);

    /**
     * 根据id查询商品
     * @param
     * @return
     */
    List<StorageOutDetailedResult> findBystorageOutNumber(@Param("storageOutNumbers")String[] storageOutNumbers);

    /**
     * app查询商品批次
     * @param
     * @return
     */
    List<StorageOutDetailedResult> findBatchstock(@Param("storageOutNumbers")String[] storageOutNumbers,@Param("goodsid") Long goodsid);


    /**
     *拣货单按库位查询商品
     * @return
     */
    Page<StorageOutDetailedResult> findByStorageOutNumbersPage(@Param("page")Page pageContext,@Param("storageOutNumbers")String storageOutNumbers);


    /**
     *出库审核拣货单按库位查询商品
     * @return
     */
    Page<StorageOutDetailedResult> findByapporderReview(@Param("page")Page pageContext,@Param("storageOutNumbers")String[] storageOutNumbers);

    /**
     * 查询拣货单商品托盘列表
     * @param goodsid
     * @param storagePostionNumber
     * @return
     */
    List<StorageOutDetailedResult> findByTrayList(@Param("storageOutNumbers")String[] storageOutNumbers,@Param("goodsid")Long goodsid,@Param("storagePostionNumber")String storagePostionNumber);


    /**
     * 出库审核查询拣货单商品托盘列表
     * @return
     */
    List<StorageOutDetailedResult> findByTrayListReview(@Param("storageOutNumbers")String[] storageOutNumbers,@Param("goodsid")Long goodsid);

    List<StorageOutDetailedResult> findName(@Param("deptId")Long deptId , @Param("deliverId")Long deliverId);

    List<StorageOutDetailedResult> findGoodsByName(@Param("deptId")Long deptId , @Param("deliverId")Long deliverId,@Param("paramCondition")StorageOutDetailedParam param);


    List<StorageOutDetailedResult> findBysON(@Param("storageOutNumber")String  storageOutNumber);
    /**
     * 查询合单商品明细或者未合单商品明细详情
     * @param pageContext
     * @param storageOutParam
     * @param condition
     * @return
     */
    Page<StorageOutDetailedResult> findByMark(@Param("page")Page pageContext, @Param("paramCondition") StorageOutParam storageOutParam, @Param("condition")String condition);

	List<StorageOutDetailedResult> getPrintstorageOutDetailed(@Param("paramCondition")StorageOutDetailedParam storageOutDetailedParam);

    List<StorageOutDetailedResult> trayInformation(@Param("paramCondition")StorageOutDetailedParam storageOutDetailedParam
    		,@Param("strs")String[] strs);

	int deletebyids(@Param("list")List<Long> list);

	List<StorageOutDetailedResult> sumfindListBySpec(@Param("paramCondition")StorageOutDetailedParam param);

    String findnumberOfLocation(@Param("storagePostionNumber")String[] storagePostionNumber, @Param("storageGoodscode")String storageGoodscode, @Param("storageOutNumber")String storageOutNumber);

	List<StorageOutDetailedResult> findalreadyListBySpec(@Param("paramCondition")StorageOutDetailedParam param
			,@Param("strs")String[] strs);

	StorageOutDetailedResult findSumBySpec(@Param("paramCondition")StorageOutDetailedParam param, @Param("outStorehouseId")Long outStorehouseId);

	List<StorageOutDetailedResult> findListBymaekSpec(@Param("paramCondition")StorageOutDetailedParam param, @Param("mark")String mark);

	List<StorageOutDetailedResult> findTotalalready(@Param("paramCondition")StorageOutDetailedParam param);

	void deleteBySpec(@Param("paramCondition")StorageOutDetailedParam param);

	void updateBySpec(@Param("paramCondition")StorageOutDetailedParam param);

	List<StorageOutDetailedResult> findByStorageOutNumbersPageNew(@Param("storageOutNumbers")String[] strs);

	StorageOutDetailedResult monthOutCount(@Param("paramCondition")StorageOutDetailedParam param, @Param("warehouseId")Long warehouseId);

	List<StorageOutDetailedResult> monthOutGoodsCount(@Param("paramCondition")StorageOutDetailedParam param, @Param("warehouseId")Long warehouseId);

	List<StorageOutDetailedResult> appMonthJianxuanCount(@Param("paramCondition")StorageOutDetailedParam param, @Param("warehouseId")Long warehouseId);

	List<StorageOutDetailedResult> wmsData(@Param("paramCondition")StorageOutDetailedParam param, @Param("warehouseId")Long warehouseId);

	StorageOutDetailedResult sumByStockId(@Param("paramCondition")StorageOutDetailedParam param);

	StorageOutDetailedResult sumCountAndYijianshu(@Param("storageOutNumbers")String[] strs);

	Page<StorageOutDetailedResult> findPageBySpecChukujilu(@Param("page")Page pageContext, @Param("paramCondition")StorageOutDetailedParam param,@Param("condition") String condition,
			@Param("outStorehouseId")Long outStorehouseId, @Param("deptId")Long deptId, @Param("deliverId")Long deliverId, @Param("operateId")Long operateId);

	List<StorageOutDetailedResult> findjianxuanzuoyehuizong(@Param("paramCondition")StorageOutDetailedParam storageOutDetailedParam,
			@Param("condition")String condition, @Param("outStorehouseId")Long outStorehouseId
			, @Param("deptId")Long deptId, @Param("deliverId")Long deliverId,@Param("operateId")Long operateId);

	List<StorageOutDetailedResult> findjianxuanzuoyehuizongRi(@Param("paramCondition")StorageOutDetailedParam storageOutDetailedParam,
			@Param("condition")String condition, @Param("outStorehouseId")Long outStorehouseId
			, @Param("deptId")Long deptId, @Param("deliverId")Long deliverId,@Param("operateId")Long operateId);

	List<StorageOutDetailedResult> findhuopinchukulianghuizong(@Param("paramCondition")StorageOutDetailedParam storageOutDetailedParam,
			@Param("condition")String condition, @Param("outStorehouseId")Long outStorehouseId
			, @Param("deptId")Long deptId, @Param("deliverId")Long deliverId, @Param("operateId")Long operateId);

	List<StorageOutDetailedResult> findgoodsbystrs(@Param("paramCondition")StorageOutDetailedParam storageOutDetailedParam, @Param("strs")String[] strs);

	List<StorageOutDetailedResult> findListStockIdBySpec(@Param("paramCondition")StorageOutDetailedParam param);

	StorageOutDetailedResult sumByStockId2(@Param("paramCondition")StorageOutDetailedParam detailedParam2,@Param("mark") String mark);

	List<StorageOutDetailedResult> trayInformationNew(@Param("paramCondition")StorageOutDetailedParam storageOutDetailedParam, @Param("strs")String[] strs);

	StorageOutDetailedResult findBySpec(@Param("paramCondition")StorageOutDetailedParam param);

	List<StorageOutDetailedResult> findByStorageOutNumbersPageNewS(@Param("paramCondition")StorageOutDetailedParam param2, @Param("strs")String[] strs);

	List<StorageOutDetailedResult> trayInformationNewBymark(@Param("paramCondition")StorageOutDetailedParam param3, @Param("strs")String[] strs);

	List<StorageOutDetailedResult> findListBySpecandstrs(@Param("paramCondition")StorageOutDetailedParam param2, @Param("strs")String[] strs);

	StorageOutDetailedResult sumBySpecandstrs(@Param("paramCondition")StorageOutDetailedParam param2,@Param("strs") String[] strs);

	StorageOutDetailedResult findtrayInformationNewBymark(@Param("paramCondition")StorageOutDetailedParam param3, @Param("strs")String[] strs);

	List<StorageOutDetailedResult> findByStorageOutNumbersPageNewexamine(@Param("storageOutNumbers")String[] strs);

	List<StorageOutDetailedResult> trayInformationNewBymarkexamine(@Param("paramCondition")StorageOutDetailedParam param3, @Param("strs")String[] strs);

	List<StorageOutDetailedResult> trayInformationNewexamine(@Param("paramCondition")StorageOutDetailedParam param3, @Param("strs")String[] strs);

	List<StorageOutDetailedResult> findjianhuomingxi(@Param("paramCondition")StorageOutDetailedParam storageOutDetailedParam, @Param("strs")String[] strs);

	List<StorageOutDetailedResult> findjianhuomingxiBymake(@Param("paramCondition")StorageOutDetailedParam storageOutDetailedParam,
			 @Param("strs")String[] strs);

	List<StorageOutDetailedResult> findjianhuomingxiBymakeexamine(@Param("paramCondition")StorageOutDetailedParam storageOutDetailedParam,
			@Param("strs")String[] strs);

	List<StorageOutDetailedResult> findjianhuomingxiexamine(@Param("paramCondition")StorageOutDetailedParam storageOutDetailedParam,
			@Param("strs")String[] strs);

	StorageOutDetailedResult sumOutByDay(@Param("paramCondition")StorageOutDetailedParam outDetailedParam,@Param("customerId")Long customerId, @Param("warehouseId")Long warehouseId);

	List<StorageOutDetailedResult> findExportToExcelBySpec(@Param("paramCondition")StorageOutDetailedParam param, @Param("operateId")Long operateId);

    List<StorageOutDetailedResult> tojianhuo(@Param("goodsNo")String goodsNo, @Param("storageOutNumber") String storageOutNumber);

    List<String> getkddByOrder(@Param("storageOutNumber") String storageOutNumber);

	List<StorageOutDetailedResult> findByStorageOutNumbersPageNew2(@Param("storageOutNumbers")String[] strs);
}
